package chapter10;

import java.util.Scanner;

/**
 * Created by lenovo on 2016/4/22.
 */
class Caesar{
    public static char[] mid=new char[100];
    public static int[] code=new int[100];
    public static int time=0;
    public static int i=0;

    public static void EncryptWrite(String write){
        time=write.length();

        for ( i=0;i<time;i++){
            mid[i]=write.charAt(i);
            code[i]=((int)mid[i]-'a'+3)%26+'a';
        }

        System.out.println("密文为：");
        for ( i=0;i<time;i++){
            System.out.printf("%c",(char)code[i]);
        }
    }
}
public class ExamOne1 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        String write="";

        System.out.println("请输入明文");
        write=scanner.nextLine();

        Caesar.EncryptWrite(write);

    }

}
